<?php
namespace Admin\Model;
use Think\Model;

//++++++++++++++无限级分类++++++++++++++

class TypeModel extends Model { 
  		 public function getType(){ 
  		 	$list = $this->where('pid = 0')->select();
  		 	foreach ($list as $key => $val) {
  		 		$list[$key]['a'] = $this->where('pid='.$val['id'])->select();
  		 		 foreach ($list[$key]['a'] as $key2 => $val2) {
  		 		 	$list[$key]['a'][$key2]['a'] = $this->where('pid='.$val2['id'])->select();
  		 		 }
  		 	}
  		 	return $list;
  		 } 

       public function getAll(){
          $av = $this->where('pid = 0')->select();
          foreach ($av as $key => $value) {
             $as[$key] = $value;
            }

            return $as;

       }

       


  }